group { name:"e/modules/tasks/item";
   script {
      public focused;
      public iconic;
      public eval_mode() {
         new is_focused = get_int(focused);
         new is_iconic  = get_int(iconic);
         if      (is_iconic)  { emit("state,iconic",  "int"); }
         else if (is_focused) { emit("state,focused", "int"); }
         else                 { emit("state,default", "int"); }
      }
      public set_focused(m) {
         set_int(focused, m);
         eval_mode();
      }
      public set_iconic(m) {
         set_int(iconic, m);
         eval_mode();
      }
   }
   parts {
      part { name: "base"; type: RECT; mouse_events: 0;
         clip_to: "clip";
         scale: 1;
         description { state: "default" 0.0;
            color_class: "/bg/normal/gadgets/tasks/base/normal";
            rel1.offset: 0 (0 - SHELFPAD);
            rel2.offset: -1 (SHELFPAD - 1);
            offscale;
         }
         description { state: "iconic" 0.0;
            inherit: "default" 0.0;
            color_class: "/bg/normal/gadgets/tasks/base/iconified";
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            color_class: "/bg/normal/gadgets/tasks/base/focused";
         }
      }
      part { name: "click"; type: RECT; mouse_events: 0;
         clip_to: "clip";
         scale: 1;
         description { state: "default" 0.0;
            color_class: "/bg/pressed/gadgets/tasks/base";
            color: 255 255 255 0; // no cc
            rel1.offset: 0 (0 - SHELFPAD);
            rel2.offset: -1 (SHELFPAD - 1);
            offscale;
         }
         description { state: "clicked" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 255; // no cc
         }
      }
      part { name: "urgent"; type: RECT; mouse_events: 0;
         clip_to: "clip";
         description { state: "default" 0.0;
            color_class: "/bg/selected/gadgets/tasks/urgent";
            color: 255 255 255 0; // no cc
         }
         description { state: "urgent" 0.0;
            inherit: "default" 0.0;
            color: 255 255 255 255; // no cc
         }
      }
      part { name: "label_clip"; type: RECT; mouse_events: 0;
         clip_to: "clip";
         description { state: "default" 0.0;
         }
         description { state: "text_only" 0.0;
            inherit: "default" 0.0;
         }
         description { state: "icon_only" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
      }
      part { name: "icon_clip"; type: RECT; mouse_events: 0;
         clip_to: "clip";
         description { state: "default" 0.0;
         }
         description { state: "text_only" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
         description { state: "icon_only" 0.0;
            inherit: "default" 0.0;
            visible: 1;
         }
      }
      part { name: "normal_clip"; type: RECT; mouse_events: 0;
         clip_to: "label_clip";
         description { state: "default" 0.0;
            visible: 1;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
         description { state: "iconic" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
      }
      part { name: "e.text.label"; type: TEXT; mouse_events: 0;
         clip_to: "normal_clip";
         scale: 1;
         description { state: "default" 0.0;
            rel1.to_x: "icon";
            rel1.relative: 1.0 0.0;
            rel1.offset: 4 4;
            rel2.offset: -5 -5;
            color_class: "/fg/normal/gadgets/tasks/text/normal";
            offscale;
            text { font: FN; size: 10;
               min: 0 1;
               align: 0.0 0.5;
               text_class: "tasks_text";
            }
         }
         description { state: "clicked" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/pressed/gadgets/tasks/text/normal";
         }
      }
      part { name: "focused_clip"; type: RECT; mouse_events: 0;
         clip_to: "label_clip";
         description { state: "default" 0.0;
            visible: 0;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            visible: 1;
         }
         description { state: "iconic" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
      }
      part { name: "label_focused"; type: TEXT; mouse_events: 0;
         clip_to: "focused_clip";
         scale: 1;
         description { state: "default" 0.0;
            rel1.to_x: "icon";
            rel1.relative: 1.0 0.0;
            rel1.offset: 4 4;
            rel2.offset: -5 -5;
            color_class: "/fg/normal/gadgets/tasks/text/focused";
            offscale;
            text { font: FNBD; size: 10;
               min: 0 1;
               align: 0.0 0.5;
               text_class: "tasks_text";
               text_source: "e.text.label";
            }
         }
         description { state: "clicked" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/pressed/gadgets/tasks/text/focused";
         }
      }
      part { name: "iconic_clip"; type: RECT; mouse_events: 0;
         clip_to: "label_clip";
         description { state: "default" 0.0;
            visible: 0;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
         description { state: "iconic" 0.0;
            inherit: "default" 0.0;
            visible: 1;
         }
      }
      part { name: "label_iconic"; type: TEXT; mouse_events: 0;
         clip_to: "iconic_clip";
         scale: 1;
         description { state: "default" 0.0;
            rel1.to_x: "icon";
            rel1.relative: 1.0 0.0;
            rel1.offset: 4 4;
            rel2.offset: -5 -5;
            color_class: "/fg/normal/gadgets/tasks/text/iconified";
            offscale;
            text { font: FN; size: 10;
               min: 0 1;
               align: 0.0 0.5;
               text_class: "tasks_text";
               text_source: "e.text.label";
            }
         }
         description { state: "clicked" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/pressed/gadgets/tasks/text/iconified";
         }
      }
      part { name: "icon"; type: SPACER;
         scale: 1;
         description { state: "default" 0.0;
            aspect: 1.0 1.0; aspect_preference: VERTICAL;
            align: 0.0 0.5;
            rel1.offset: 4 4;
            rel2.relative: 0.0 1.0;
            rel2.offset: 4 -5;
            offscale;
         }
         description { state: "icon_only" 0.0;
            inherit: "default" 0.0;
            align: 0.5 0.5;
            rel1.offset: 4 4;
            rel2.relative: 1.0 1.0;
            rel2.offset: -5 -5;
         }
         description { state: "text_only" 0.0;
            inherit: "default" 0.0;
            aspect: 0.0 0.0; aspect_preference: NONE;
            rel1.offset: 0 0;
            rel2.relative: 0.0 1.0;
            rel2.offset: -1 -1;
            max: 0 0;
            fixed: 1 1;
         }
      }
      part { name: "icon2"; type: SPACER;
         description { state: "default" 0.0;
            rel.to: "icon";
            fixed: 1 1;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
         }
         description { state: "iconic" 0.0;
            inherit: "default" 0.0;
            rel1.relative: 0.2 0.2;
            rel2.relative: 0.8 0.8;
         }
      }
      part { name: "bar"; type: RECT; mouse_events: 0;
         scale: 1;
         clip_to: "clip";
         description { state: "default" 0.0;
            color_class: "/bg/selected/gadgets/tasks/bar";
            align: 0.5 1.0;
            rel1.offset: 0 (SHELFPAD - 1);
            rel1.relative: 0.0 1.0;
            rel2.offset: -1 (SHELFPAD - 1);
            fixed: 0 1;
            visible: 0;
            min: 0 0;
            offscale;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            visible: 1;
            min: 0 5;
         }
      }
      part { name: "e.swallow.icon"; type: SWALLOW; mouse_events: 0;
         clip_to: "icon_clip";
         description { state: "default" 0.0;
            aspect: 1.0 1.0; aspect_preference: VERTICAL;
            rel.to: "icon2";
         }
      }
      part { name: "event"; type: RECT;
         ignore_flags: ON_HOLD;
         description { state: "default" 0.0;
            color: 0 0 0 0; // no cc
         }
      }
      part { name: "clip"; type: RECT;
         scale: 1;
         description { state: "default" 0.0;
            rel1.offset: -80 -80;
            rel2.offset: 79 79;
            offscale;
            visible: 1;
         }
         description { state: "selected" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
         description { state: "iconic" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
      }
      part { name: "sel_clip"; type: RECT;
         description { state: "default" 0.0;
            rel1.offset: -80 -80;
            rel2.offset: 79 79;
            visible: 0;
         }
         description { state: "selected" 0.0;
            inherit: "default" 0.0;
            visible: 1;
         }
         description { state: "iconic" 0.0;
            inherit: "default" 0.0;
            visible: 0;
         }
      }
   }
   programs {
      program { signal: "mouse,down,1"; source: "event";
         action: STATE_SET "clicked" 0.0;
         target: "click";
         target: "e.text.label";
         target: "label_focused";
         target: "label_iconic";
      }
      program { signal: "mouse,up,1"; source: "event";
         action: STATE_SET "default" 0.0;
         target: "click";
         target: "e.text.label";
         target: "label_focused";
         target: "label_iconic";
      }
      program { signal: "mouse,up,clicked,1*"; source: "event";
         action: SIGNAL_EMIT "e,action,click" "";
      }

      program { signal: "e,state,focused"; source: "e";
         action: STATE_SET "focused" 0.0;
         transition: ACCELERATE 0.2 USE_DURATION_FACTOR 1;
         target: "bar";
      }
      program { signal: "e,state,unfocused"; source: "e";
         action: STATE_SET "default" 0.0;
         transition: DECELERATE 0.2 USE_DURATION_FACTOR 1;
         target: "bar";
      }

      program { signal: "state,default"; source: "int";
         action: STATE_SET "default" 0.0;
         target: "normal_clip";
         target: "focused_clip";
         target: "iconic_clip";
         target: "base";
      }
      program { signal: "state,default"; source: "int";
         action: STATE_SET "default" 0.0;
         transition: SINUSOIDAL 0.2 USE_DURATION_FACTOR 1;
         target: "icon2";
      }
      program { signal: "state,focused"; source: "int";
         action: STATE_SET "focused" 0.0;
         target: "normal_clip";
         target: "focused_clip";
         target: "iconic_clip";
         target: "base";
      }
      program { signal: "state,focused"; source: "int";
         action: STATE_SET "focused" 0.0;
         transition: SINUSOIDAL 0.2 USE_DURATION_FACTOR 1;
         target: "icon2";
      }
      program { signal: "state,iconic"; source: "int";
         action: STATE_SET "iconic" 0.0;
         target: "normal_clip";
         target: "focused_clip";
         target: "iconic_clip";
         target: "base";
      }
      program { signal: "state,iconic"; source: "int";
         action: STATE_SET "iconic" 0.0;
         transition: SINUSOIDAL 0.2 USE_DURATION_FACTOR 1;
         target: "icon2";
      }

      program { signal: "e,state,focused"; source: "e";
         script { set_focused(1); }
      }
      program { signal: "e,state,unfocused"; source: "e";
         script { set_focused(0); }
      }
      program { signal: "e,state,iconified"; source: "e";
         script { set_iconic(1); }
      }
      program { signal: "e,state,uniconified"; source: "e";
         script { set_iconic(0); }
      }

      program { name: "urg1";
         signal: "e,state,urgent"; source: "e";
         action: STATE_SET "urgent" 0.0;
         in: 0.4 0.0;
         transition: SINUSOIDAL 0.2;
         target: "urgent";
         after: "urg2";
      }
      program { name: "urg2";
         action: STATE_SET "default" 0.0;
         transition: SINUSOIDAL 0.2;
         target: "urgent";
         after: "urg1";
      }
      program { signal: "e,state,not_urgent"; source: "e";
         action: ACTION_STOP;
         target: "urg1";
         target: "urg2";
         after: "noturg2";
      }
      program { name: "noturg2";
         action: STATE_SET "default" 0.0;
         target: "urgent";
      }

      program { signal: "e,state,icon_only"; source: "e";
         action: STATE_SET "icon_only" 0.0;
         target: "icon";
         target: "icon_clip";
         target: "label_clip";
      }
      program { signal: "e,state,text_only"; source: "e";
         action: STATE_SET "text_only" 0.0;
         target: "icon";
         target: "icon_clip";
         target: "label_clip";
      }
   }
}

group { name:"e/modules/tasks/item_vert";
   inherit: "e/modules/tasks/item";
   script {
      public focused;
      public iconic;
      public eval_mode() {
         new is_focused = get_int(focused);
         new is_iconic  = get_int(iconic);
         if      (is_iconic)  { emit("state,iconic",  "int"); }
         else if (is_focused) { emit("state,focused", "int"); }
         else                 { emit("state,default", "int"); }
      }
      public set_focused(m) {
         set_int(focused, m);
         eval_mode();
      }
      public set_iconic(m) {
         set_int(iconic, m);
         eval_mode();
      }
   }
   parts {
      part { name: "base"; type: RECT; mouse_events: 0;
         description { state: "default" 0.0;
            rel1.offset: (0 - SHELFPAD) 0;
            rel2.offset: (SHELFPAD - 1) -1;
         }
         description { state: "iconic" 0.0;
            inherit: "default" 0.0;
            color_class: "/bg/selected/gadgets/tasks/base/iconified";
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            color_class: "/bg/selected/gadgets/tasks/base/focused";
         }
      }
      part { name: "e.text.label";
         description { state: "default" 0.0;
            rel.to: "icon";
            rel1.offset: 0 0;
            rel2.offset: -1 -1;
            visible: 0;
         }
         description { state: "clicked" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/pressed/gadgets/tasks/text/normal";
         }
      }
      part { name: "label_focused";
         description { state: "default" 0.0;
            rel.to: "icon";
            rel1.offset: 0 0;
            rel2.offset: -1 -1;
            visible: 0;
         }
         description { state: "clicked" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/pressed/gadgets/tasks/text/focused";
         }
      }
      part { name: "label_iconic";
         description { state: "default" 0.0;
            rel.to: "icon";
            rel1.offset: 0 0;
            rel2.offset: -1 -1;
            visible: 0;
         }
         description { state: "clicked" 0.0;
            inherit: "default" 0.0;
            color_class: "/fg/pressed/gadgets/tasks/text/iconified";
         }
      }
      part { name: "icon";
         description { state: "default" 0.0;
            aspect_preference: BOTH;
            align: 0.5 0.5;
            rel2.relative: 1.0 1.0;
            rel2.offset: -5 -5;
         }
         description { state: "icon_only" 0.0;
            inherit: "default" 0.0;
            align: 0.5 0.5;
            rel1.offset: 4 4;
            rel2.relative: 1.0 1.0;
            rel2.offset: -5 -5;
         }
         description { state: "text_only" 0.0;
            rel2.relative: 1.0 0.0;
            max: 0 0;
         }
      }
      part { name: "bar"; type: RECT;
         description { state: "default" 0.0;
            align: 1.0 0.5;
            rel1.offset: 2 0;
            rel1.relative: 1.0 0.0;
            rel2.offset: 2 -1;
            fixed: 1 0;
         }
         description { state: "focused" 0.0;
            inherit: "default" 0.0;
            align: 1.0 0.5;
            rel1.relative: 1.0 0.0;
            fixed: 1 0;
            min: 5 0;
            visible: 1;
         }
      }
   }
}
